import time
def buble(a):
    ended = True
    while ended:
        ended = False
        for i in range(1,len(a)):
            if a[i]<a[i-1]:

                ended = True
                a[i],a[i-1] = a[i-1],a[i]
with open('m1_sorted.txt') as f:
    g = list(map(int, f.readlines()))
    t = time.time()
    buble(g)
    t2 = time.time()
    print("time in sorted = "+ str(t2 - t))
    print(g[:10])
with open('m2_reverse.txt') as m:
    m2 = list(map(int, m.readlines()))
    t = time.time()
    buble(m2)
    t1 = time.time()
    print("time in reverse = "+ str(t1 - t))
    print(m2[:10])
with open('m3_shuffle.txt') as f:
    g = list(map(int, f.readlines()))
    t = time.time()
    buble(g)
    t3 = time.time()
    print("time in shuffle = " + str(t3 - t))
    print(g[:10])
